package lab02.test20;

import java.util.Scanner;

/**
 * Created by admin on 2017/10/30.
 */
public class Test {
    public static void main(String[] args) {
//	编写一个应用程序，用户从键盘输入一行含有数字和字符的字符串，程序仅仅输出字符串中的全部数字字符。
        Scanner in = new Scanner(System.in);
        System.out.println("输入一行含有数字和字符的字符串：");
        String string = in.next();
        StringBuffer stringBuffer = new StringBuffer();
        char tem;
        for (int i = 0; i < string.length(); i++) {
            tem = string.charAt(i);
            if (string.charAt(i) >= '0' && string.charAt(i) <= '9'){
            stringBuffer.append(tem);
        }
    }
    System.out.println(stringBuffer);
}
}
